package com.mmall.controller;

import com.mmall.common.ServerResponse;
import com.mmall.param.SearchLogParam;
import com.mmall.service.ISysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author wangtengyu
 * @Create 2018-03-20-11:13
 */
@Controller
@RequestMapping("/sys/log")
public class SyslogController {

    @Autowired
    private ISysLogService iSysLogService;

    @RequestMapping("/log.page")
    public ModelAndView page(){
        return new ModelAndView("log");
    }



    @RequestMapping("/recover.json")
    @ResponseBody
    public ServerResponse recover(@RequestParam("id") int id) {
        //iSysLogService.recover(id);
        return ServerResponse.createBySuccess();
    }

    @RequestMapping("/page.json")
    @ResponseBody
    public ServerResponse searchPage(SearchLogParam param, @RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize) {
        return ServerResponse.createBySuccess(iSysLogService.searchPageList(param, pageNum,pageSize));
    }
}
